package com.sisyphus.simple.activities;

import android.content.Intent;
import android.os.Bundle;

import com.sisyphus.simple.R;
import com.sisyphus.simple.adapters.PostListAdapter;
import com.sisyphus.spinach.ui.configs.IActivityConfigProvider;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;

public class MainActivity extends AppCompatActivity implements IActivityConfigProvider {

    @Override
    public int getLayoutResID() {
        return R.layout.activity_main;
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // 登录页面
        findViewById(R.id.button_login).setOnClickListener(v ->
                startActivity(new Intent(this, LoginActivity.class)));

        RecyclerView recyclerView = findViewById(R.id.recycler_view);
        new PagerSnapHelper().attachToRecyclerView(recyclerView);
        PostListAdapter adapter = new PostListAdapter();
        recyclerView.setAdapter(adapter);

        // 热门帖子
//        NetTaskFactory.get(
//                getLifecycle(),
//                DataRepository.getInstance().hot(),
//                new ToastView<>(this, new QuickList<>(adapter)));
    }

}
